package org.sample.vm.oom;

/**
 * VM stack out of memory.
 * 
 * VM Args: -Xss2M
 */
public class VMStackOOM {

	private void dontStop() {
		while (true) {
		}
	}

	public void stackLeakByThread() {
		while (true) {
			Thread thread = new Thread(new Runnable() {
				@Override
				public void run() {
					dontStop();
				}
			});
			thread.start();
		}
	}

	public static void main(String[] args) {
		VMStackOOM oom = new VMStackOOM();
		oom.stackLeakByThread();
	}

}
